package com.stylefeng.guns.modular.pay.util;

import java.util.Random;

public class RandomUtil {
	public static String getRandom(int num) {
		String str = "0123456789";
		StringBuilder sb = new StringBuilder(4);
		for (int i = 0; i < 4; i++) {
			char ch = str.charAt(new Random().nextInt(str.length()));
			sb.append(ch);
		}
		System.out.println("短信验证码："+sb.toString());
		return sb.toString();
	}

	public static void main(String[] args) {
		String str = "0123456789";
		StringBuilder sb = new StringBuilder(4);
		for (int i = 0; i < 4; i++) {
			char ch = str.charAt(new Random().nextInt(str.length()));
			sb.append(ch);
		}
		System.out.println(sb.toString());

	}

}
